﻿#ifndef SERIALTLV_H
#define SERIALTLV_H

#include <QObject>
#include <QList>

#include "../Com/ICom.h"


class QSerialPort;


class SerialTlv : public ICom
{
    Q_OBJECT
public:
    explicit SerialTlv(QObject *parent = nullptr);
    virtual ~SerialTlv();

    bool isOpen() const override;
    QString hwName() const override;

    QString portName() const;
    uint32_t baudRate() const;
    void setAttr(const QString &portName, uint32_t baudRate = 1000000);

    static SerialTlv* instance();

public slots:
    void open() override;
    void close() override;

protected:
    void IWrite(const QByteArray &data) override;

private:
    QSerialPort *m_serialPort;
};

#define SerTlvIns (SerialTlv::instance())

#endif // SERIALTLV_H
